home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / load.act < prev    next >
Text File  |  1995-04-22  |  2KB  |  87 lines

  1. ; This fragment loads an Action! 
  2. ;  program and executes it 
  3. ;  (thru INITAD).  This fragment can be 
  4. ;  easily modified to support any type 
  5. ;  of binary load file by checking the 
  6. ;  status of INITAD and RUNAD after 
  7. ;  each block of code has been loaded. 
  8. ; If you want this fragment to remain 
  9. ;  resident, you must compile to a 
  10. ;  specific location (outside your own 
  11. ;  program, obviously) using either the 
  12. ;  SET $E/SET $491 method or using 
  13. ;  SET $B5 to set a compilation offset 
  14. ;  (Note: due to a bug in the Action! 
  15. ;  compiler offset routine, you can 
  16. ;  only specify a positive offset) 
  17. ; Once the program is compiled, type: 
  18. ;      ?Load 
  19. ;  from the monitor to obtain the 
  20. ;  runtime address.  In your own source 
  21. ;  that calls Load, you must insert the 
  22. ;  following line before its use: 
  23. ;      PROC Load=$xxxx(CHAR ARRAY str) 
  24. ;  where "$xxxx" is the address you 
  25. ;  found above, and where the CHAR 
  26. ;  ARRAY "str" is the complete filespec 
  27. ;  of the program you want to load. 
  28.  
  29.  
  30. MODULE ;LOAD.ACT 
  31.  
  32. BYTE 
  33.   CIO_status 
  34.  
  35. CARD 
  36.   start, 
  37.   len 
  38.  
  39. ; NOTE: CIO and ReadBlock are 
  40. ;  copyrighted routines of 
  41. ;  Action! computer services 
  42. ;  Credit such as this of their origin 
  43. ;  must be given if used in your own 
  44. ;  program source 
  45. CHAR FUNC CIO=*(BYTE dev, CARD addr,size, BYTE cmd,aux1,aux2) 
  46.  [$29$F$85$A0$86$A1$A$A$A$A$AA$A5$A5$9D$342$A5$A3$9D$348$A5$A4$9D$349$A5$A6$F0$8$9D$34A$A5$A7$9D$34B$98$9D$345 
  47.   $A5$A1$9D$344$20$E456$8C CIO_status$C0$88$D0$6$98$A4$A0$99 EOF$60] 
  48. CARD FUNC ReadBlock=*(BYTE dev, CARD addr, size) 
  49.  [$48$A9$7$85$A5$A9$0$85$A6$A5$A3$5$A4$D0$6$85$A0$85$A1$68$60$68$20 CIO$BD$348$85$A0$BD$349$85$A1$60] 
  50.  
  51.  
  52. ; MAINLINE **************************** 
  53.  
  54. CARD FUNC GetOne() 
  55. BYTE 
  56.   cLow 
  57. CARD 
  58.   cHigh 
  59.  
  60.   DO 
  61.     cLow=GetD(1) cHigh=GetD(1) 
  62.     cHigh== LSH 8 % cLow 
  63.   UNTIL cHigh#$FFFF OD 
  64. RETURN(cHigh) 
  65.  
  66.  
  67. PROC GetAddrs=*() 
  68.   start=GetOne() 
  69.   len=GetOne()-start+1 
  70. RETURN 
  71.  
  72.  
  73. PROC Load(CHAR ARRAY filespec) 
  74. CARD 
  75.   INITAD=$2E2 
  76.  
  77.   Close(1) 
  78.   Open(1,filespec,4,0) 
  79.  
  80.   WHILE start#$2E2 DO 
  81.     GetAddrs() 
  82.     ReadBlock(1,start,len) 
  83.   OD 
  84.   Close(1) 
  85.   [$6C INITAD] 
  86.  
  87.